<?php

/**
 * MedicamentoInventario filter form base class.
 *
 * @package    sibi-salud
 * @subpackage filter
 * @author     SIBI <sibiud@gmail.com>
 */
abstract class BaseMedicamentoInventarioFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'medicamento_id' => new sfWidgetFormPropelChoice(array('model' => 'Medicamento', 'add_empty' => true)),
      'sede_id'        => new sfWidgetFormPropelChoice(array('model' => 'Sede', 'add_empty' => true)),
      'area_salud_id'  => new sfWidgetFormPropelChoice(array('model' => 'AreaSalud', 'add_empty' => true)),
      'cantidad'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'medicamento_id' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Medicamento', 'column' => 'id')),
      'sede_id'        => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Sede', 'column' => 'id')),
      'area_salud_id'  => new sfValidatorPropelChoice(array('required' => false, 'model' => 'AreaSalud', 'column' => 'id')),
      'cantidad'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('medicamento_inventario_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'MedicamentoInventario';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'medicamento_id' => 'ForeignKey',
      'sede_id'        => 'ForeignKey',
      'area_salud_id'  => 'ForeignKey',
      'cantidad'       => 'Number',
    );
  }
}
